package com.sgcc.pda.frme.protocol.ws.bean;

/**
 * author : Yangzhi
 * date : 2020/3/20 10:32
 * description :正常应答数据基类
 */
public class BaseSuccDataBean {
    //功能码
    public int funCode;

    public String getFunCode() {
        return str2HexStr(funCode + "");
    }

    public void setFunCode(int funCode) {
        this.funCode = funCode;
    }

    /***
     * String 转16进制string
     *
     * @param str
     * @return
     */

    public static String str2HexStr(String str) {
        char[] chars = "0123456789ABCDEF".toCharArray();
        StringBuilder sb = new StringBuilder("");
        byte[] bs = str.getBytes();
        int bit;
        for (int i = 0; i < bs.length; i++) {
            bit = (bs[i] & 0x0f0) >> 4;
            sb.append(chars[bit]);
            bit = bs[i] & 0x0f;
            sb.append(chars[bit]);
        }
        return sb.toString();
    }

}
